home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / bptree.zip / FREE.C < prev    next >
Text File  |  1992-09-04  |  746b  |  22 lines

  1. void FAR *Malloc( DWORD cbSize ) {
  2.      return GlobalLock( GlobalAlloc( GHND, cbSize ) );
  3. }
  4.  
  5. void Free( void FAR *lpMemory ) {
  6.      GLOBALHANDLE hMemory;
  7.      if ( lpMemory == NULL ) return;
  8.      hMemory = (GLOBALHANDLE)GlobalHandle( (UINT)SELECTOROF( hMemory ) );
  9.      GlobalUnlock( hMemory );
  10.      GlobalFree( hMemory );
  11. }
  12.  
  13. void FAR *Realloc( void FAR *lpMemory, DWORD cbNewSize ) {
  14.      GLOBALHANDLE hMemory, hNewMemory;
  15.      if ( lpMemory == NULL ) return NULL;
  16.      hMemory = (GLOBALHANDLE)GlobalHandle( (UINT)SELECTOROF( hMemory ) );
  17.      GlobalUnlock( hMemory );
  18.      hNewMemory = GlobalReAlloc( hMemory, cbNewSize, GMEM_MOVEABLE );
  19.      if ( hNewMemory == NULL ) return NULL;
  20.      return( GlobalLock( hMemory ) );
  21. }
  22.